-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: multichain support #38
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice one ser ! 🫡
for (const orchestrator of this.orchestrators.values()) { | ||
this.logger.info(`Starting orchestrator for chain ${orchestrator.chainId}...`); | ||
orchestratorProcesses.push(orchestrator.run(abortController.signal)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const orchestrator of this.orchestrators.values()) { | |
this.logger.info(`Starting orchestrator for chain ${orchestrator.chainId}...`); | |
orchestratorProcesses.push(orchestrator.run(abortController.signal)); | |
} | |
const orchestratorProcesses = this.orchestrators.values().map(orchestrator=>orchestrator.run); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we're not passing the AbortController here, the AbortController is so we can gracefully exit the app so it finishes the current event being processed and then exits the app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's missing in my suggestion but you can xd
orchestratorProcesses.push(orchestrator.run(abortController.signal)); | ||
} | ||
|
||
await Promise.allSettled(orchestratorProcesses); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets keep in mind that we should make all the orchestrators to be infinite running processes, never throw errors, and have automatic recovery. This is to avoid affecting the others. In case we have inifinite running processes and never throw errors, then Promise.allSettled or Promise.all both should be the same since none of the processes resolve. Apart from automatic recovery we should notify once there is a critical error that kills the specific orchestrator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree that all and allSettled are the same here. You're suggesting to use all so we can catch early a possible Fatal error that killed the Orchestrator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be the same using allSettled
or all
because all are infinite processes and each of them should avoid bubbling up errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some optional questions/comment👍
// Initialize EVM provider | ||
const evmProvider = new EvmProvider(env.RPC_URLS, optimism, this.logger); | ||
for (const chain of chains) { | ||
const chainLogger = new Logger({ chainId: chain.id as ChainId }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to initialize a logger for each chain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we come up to this change because we want to distinguish logs for each chain (adding some identifier string as part of general formatting)
@@ -55,13 +55,22 @@ export class SharedDependenciesService { | |||
kyselyDatabase, | |||
env.DATABASE_SCHEMA, | |||
); | |||
const pricingProvider = PricingProviderFactory.create(env, { logger }); | |||
const pricingProvider = PricingProviderFactory.create(env, { | |||
logger: new Logger({ className: "PricingProvider" }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to my last comment, do you think it's better not to use DI for the logger?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm could be 🤔 but at the same time i like DI... wdyt @0xkenj1
import { Orchestrator } from "@grants-stack-indexer/data-flow"; | ||
|
||
import type { Environment } from "../../src/config/env.js"; | ||
import { ProcessingService } from "../../src/services/processing.service.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import from index no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, however i don't think is much of a problem in test files
🤖 Linear
Closes GIT-177 GIT-178 GIT-179
Description
Checklist before requesting a review